home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Libraries / Advanced I⁄O v2.3 / Advanced i⁄o / arithm_modadapt.h < prev    next >
Text File  |  1995-05-10  |  2KB  |  77 lines

  1. // This may look like C code, but it is really -*- C++ -*-
  2. /*
  3.  ************************************************************************
  4.  *
  5.  *               Adaptive Arithmetic Coding
  6.  *                 Adaptive model for the source of data
  7.  *
  8.  * This is an extension over the basic Input_Data_Model which makes
  9.  * an adaptive model for the input data.
  10.  *
  11.  * The present model is adjusted to coding node values of the Laplacian 
  12.  * pyramid decomposition of gray-scale still images. Distribution of
  13.  * the values is found (see laplpyr_hist.lst) to be almost ideally
  14.  * modelled by the Lorentzian distribution with the very strong peak at
  15.  * 0. This apriori information is coded into the frequency tables. As
  16.  * symbol are processed, the frequency tables are updated (in the
  17.  * way it is described in the book "Text Compression" referred to
  18.  * elsewhere) to finely tune in the distribution.
  19.  *
  20.  * The program assumes the total no. of distinct input symbols
  21.  * (integers) is relatively small, so simple linear arrays can be used
  22.  * for storing and looking up the frequency tables. 
  23.  *
  24.  * $Id: arithm_modadapt.h,v 2.0 1995/02/07 19:37:06 oleg Exp oleg $
  25.  *
  26.  ************************************************************************
  27.  */
  28.  
  29. #ifndef __GNUC__
  30. #pragma once
  31. #endif
  32. #ifndef _arithm_modadapt_h
  33. #define _arithm_modadapt_h 1
  34.  
  35. #ifdef __GNUC__
  36. #pragma interface
  37. #endif
  38.  
  39. #include "arithm.h"
  40.  
  41. class AdaptiveModel : public Input_Data_Model
  42. {
  43.   const Symbol symbol_lwb;    // Region the input symbol is expected in
  44.   const Symbol symbol_upb;
  45.   const int    no_symbols;    // No. of distinct symbols
  46.  
  47.   Index  * symbol_to_index;    // Symbol-to-index conversion
  48.   Symbol * index_to_symbol;    // Conversion from symbol index to symbol value
  49.  
  50.   void initialize_model();
  51.  
  52. public:
  53.                     // Construct a model for symbols
  54.                     // in [lwb,upb]
  55.   AdaptiveModel(const Symbol lwb, const Symbol upb);
  56.   ~AdaptiveModel(void);
  57.  
  58.                     // Model is adaptive, there is
  59.                     // no need to write/read parameters
  60.                     // to/from the file
  61.   void open(BitIn& file)             {}
  62.   void open(BitOut& file)             {}
  63.  
  64.                     // Update the adaptive model
  65.   void update_model(const Index index);     
  66.  
  67.                     // Do nothing at present
  68.   void scale_down_past(void)            {}
  69.  
  70.                     // Return the index of a symbol
  71.   Index  get_index(const Symbol symbol) const;
  72.                     // and the symbol for an index
  73.   Symbol get_symbol(const Index index) const;
  74. };
  75.  
  76. #endif
  77.